﻿<views:RequestItemDetailsView
    x:Class="SpaceNeedle.x6473.WindowsPhone.Views.RequestItemDetails"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:views="clr-namespace:SpaceNeedle.x6473.WindowsPhone.Views"
    xmlns:controls="clr-namespace:SpaceNeedle.x6473.WindowsPhone.Controls"
    xmlns:viewmodels="clr-namespace:SpaceNeedle.x6473.WindowsPhone.ViewModels"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    mc:Ignorable="d"
    shell:SystemTray.IsVisible="True" shell:SystemTray.Opacity="0">

    <d:Page.DataContext>
        <viewmodels:RequestViewModelSampleData />
    </d:Page.DataContext>

    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" Background="Transparent">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <StackPanel Grid.Row="0" Margin="12,17,0,28">
            <TextBlock Text="{Binding AppContent.Name}" Style="{StaticResource PhoneTextNormalStyle}" FontFamily="Segoe WP SemiLight"/>
            <TextBlock Text="solicitação" Margin="9,20,0,0" Style="{StaticResource PhoneTextTitle1Style}"  FontFamily="Portable User Interface"/>
        </StackPanel>

        <ScrollViewer x:Name="ContentPanel" Grid.Row="1" >
            <StackPanel Orientation="Vertical" Margin="28,0,0,0">
            <StackPanel Orientation="Horizontal" Margin="0,0,0,20">
                <Border Width="96" Height="96" Background="{StaticResource PhoneAccentBrush}" VerticalAlignment="Top">
                    <Image Source="{Binding RequestItem.RequestIcon}" Width="64" Height="64" Stretch="UniformToFill" VerticalAlignment="Center"/>
                </Border>
                <StackPanel Orientation="Vertical" Margin="10,0,0,0" VerticalAlignment="Top" >
                    <TextBlock FontSize="36" Text="{Binding RequestItem.RequestTitle}" TextTrimming="WordEllipsis"/>
                    <TextBlock FontSize="22" Margin="0,0,0,20" Foreground="Gray" Text="{Binding RequestItem.RequestDescription}" MaxWidth="320" TextWrapping="Wrap" HorizontalAlignment="Left"/>
                </StackPanel>
            </StackPanel>
                <StackPanel Margin="0,0,28,0">
                    <StackPanel x:Name="protocolNumberStack" Visibility="Collapsed">
                        <TextBlock Text="{Binding AppContent.Tickets.ProtocolNumber}" FontSize="28"/>
                        <TextBlock Text="{Binding RequestItem.Number}" Foreground="Gray" Margin="0,0,0,20" HorizontalAlignment="Left" TextWrapping="Wrap"  VerticalAlignment="Top" FontSize="20" FontFamily="Segoe WP Light" />
                    </StackPanel>
                    <TextBlock Text="Endereço" FontSize="28"/>
                <TextBlock Text="{Binding RequestItem.UserTypedAddress}" Foreground="Gray" Margin="0,0,0,20" HorizontalAlignment="Left" TextWrapping="Wrap"  VerticalAlignment="Top" FontSize="20" FontFamily="Segoe WP Light" />

                <TextBlock Text="Localização" FontSize="28"/>
                <Image Source="{Binding MapAddress}" Margin="0,0,0,20" Tap="Image_Tap" Tag="{Binding RequestItem.Geoposition}"/>
                
                <TextBlock Text="Solicitado Por" FontSize="28"/>
                    <TextBlock Text="{Binding RequestItem.CreatedByName}" Foreground="Gray" Margin="0,0,0,20" HorizontalAlignment="Left" TextWrapping="Wrap"  VerticalAlignment="Top" FontSize="20" FontFamily="Segoe WP Light" />

                <TextBlock Text="Data" FontSize="28"/>
                    <TextBlock Text="{Binding RequestItem.CreationDate, StringFormat='dd/MM HH:mm'}" Foreground="Gray" Margin="0,0,0,20" HorizontalAlignment="Left" TextWrapping="Wrap"  VerticalAlignment="Top"  FontSize="20" FontFamily="Segoe WP Light" />

                <TextBlock Text="Apoiadores" FontSize="28"/>
                <StackPanel Margin="0,0,0,20" HorizontalAlignment="Left" VerticalAlignment="Top" Orientation="Horizontal">
                    <TextBlock x:Name="supportersCountTextBlock" Foreground="Gray" VerticalAlignment="Center" />
                    <Image Source="/Assets/AppBar/social.like.png" VerticalAlignment="Center"/>
               </StackPanel>

                <TextBlock Text="Situação" FontSize="28"/>
                <TextBlock FontSize="18" Margin="0,0,0,20" Text="{Binding RequestItem.Status, Converter={StaticResource RequestItemStatusToStringConverter}}" Foreground="{StaticResource PhoneAccentBrush}" />

                <TextBlock Text="Foto" FontSize="28"/>
                <Border Background="LightGray" Margin="0,0,0,20" HorizontalAlignment="Left" VerticalAlignment="Top" >
                <Image Name="requestPhotoImage" Stretch="Uniform" Source="{Binding RequestItem.Photo}" Tap="OnRequestPhotoImage_Tap"/>
            </Border>

                <TextBlock Text="Descrição" FontSize="28"/>

                <TextBlock Text="{Binding RequestItem.Description}" Margin="0,5,0,40" HorizontalAlignment="Left" Foreground="Gray"  TextWrapping="Wrap"  VerticalAlignment="Top" FontSize="20" FontFamily="Segoe WP Light" />
                </StackPanel>
            </StackPanel>

        </ScrollViewer>
        <ProgressBar Visibility="{Binding IsInProgress, Converter={StaticResource BooleanToVisibilityConverter}}" Style="{StaticResource ProgressStyle}" VerticalAlignment="Top" />
        <controls:NewtworkStatusControl/>

    </Grid>

    <phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar Mode="Default" Opacity="1.0" IsMenuEnabled="True" IsVisible="True">
            <shell:ApplicationBarIconButton x:Name="shareAppBarButton" IconUri="/Assets/AppBar/share.png" Text="compartilhar" Click="OnShareAppBarButton_Click"/>
            <shell:ApplicationBarIconButton x:Name="supportAppBarButton" IconUri="/Assets/AppBar/add.png" Text="apoiar" IsEnabled="True" Click="OnSupportAppBarButton_Click"/>
            <shell:ApplicationBar.MenuItems>
                <shell:ApplicationBarMenuItem x:Name="uploadsMenuItem" Text="uploads" Click="OnUploadsMenuItem_Click"/>
                <shell:ApplicationBarMenuItem x:Name="aboutMenuItem" Text="sobre" Click="OnAboutMenuItem_Click"/>
                <shell:ApplicationBarMenuItem x:Name="signoutMenuItem" Text="sair" Click="OnSignOutMenuItem_Click"/>
            </shell:ApplicationBar.MenuItems>
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>

</views:RequestItemDetailsView>